<?php

namespace slinks\extensions\onecms\cms\joomla;

use slinks\extensions\onecms\core\templating\IResourceManager;

/**
 * Joomla resource manager. 
 * 
 * @author Navid Mitchell
 * @Service
 * @Scope(public=false)
 */
class JoomlaResourceManager implements IResourceManager {

    /**
     * Adds the definition of a linked external script to the document object. Duplicates are ignored.
     *
     * @param string $url URL of script.
     * @param string $type MIME type of script.	'text/javascript'
     */
    public function addScript($url, $type='text/javascript') {
        $doc = & \JFactory::getDocument();
        $doc->addScript($url, $type);
    }

    public function addScriptDeclaration($content){
        $doc = & \JFactory::getDocument();
        $doc-> addScriptDeclaration($content);
    }

    /**
     * Adds the definition of a linked external stylesheet to the document. Duplicates are ignored.
     *
     * @param string $url URL of stylesheet.
     * @param string $type MIME type of script.	'text/css'
     * @param string $media Media type that the stylesheet applies to.
     */
    public function addStyleSheet($url, $type='text/css', $media=null) {
        $doc = & \JFactory::getDocument();
        $doc->addStyleSheet($url, $type, $media);
    }

    public function getBaseURL() {
        return \JURI::base();
    }

}